﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UI.JsonModel;

namespace WebPlatform.Models
{
    public class ModuleVM:ITreeNode
    {

        /// <summary>
        /// 模块ID
        /// </summary>
        public string ModuleID { get; set; }


        /// <summary>
        /// 模块名称
        /// </summary>
        public string ModuleName { get; set; }


        /// <summary>
        /// 模块路径
        /// </summary>
        public string ModulePath { get; set; }


        /// <summary>
        /// 是否启用模块
        /// </summary>
        public int Enabled { get; set; }


        /// <summary>
        /// 模块排序号
        /// </summary>
        public int SortNumber { get; set; }


        #region tree attr


        string _id;
        /// <summary>
        /// 节点ID
        /// </summary>
        public string id
        {
            get
            {
                return string.IsNullOrEmpty(_id) ? Guid.NewGuid().ToString("N") : _id;

            }
            set { _id = value; }
        }

        bool _isexpand = false;
        /// <summary>
        /// 是否展开
        /// </summary>
        public bool isexpand
        {
            get
            {
                return _isexpand;
            }
            set
            {
                _isexpand = value;
            }
        }
        bool _ischecked = false;
        /// <summary>
        /// 是否选中
        /// </summary>
        public bool ischecked
        {
            get
            {
                return _ischecked;
            }
            set
            {
                _ischecked = value;
            }
        }
        /// <summary>
        /// 父编号
        /// </summary>
        public string parentCode
        {
            get;
            set;
        }
        /// <summary>
        /// 节点图标
        /// </summary>
        public string icon
        {
            get;
            set;
        }

        IList<ITreeNode> _children = null;
        /// <summary>
        /// 子节点
        /// </summary>
        public IList<ITreeNode> children
        {
            get
            {
                if (_children == null)
                {
                    _children = new List<ITreeNode>();
                }
                return _children;
            }
        }

        /// <summary>
        /// 是否叶子,true 是/false 不是
        /// </summary>
        public bool isLeaf
        {
            get;
            set;
        }
        /// <summary>
        /// 是否显示复选框
        /// </summary>
        public bool isCheckBox { get; set; }


        #endregion
    }
}